#include "newaddresstab.h"
#include "adddialog.h"

NewAddressTab::NewAddressTab(QWidget *parent):QWidget(parent)
{
    auto descLabel = new QLabel("There are currently no contacts in your address book. "
                                "\nClick Add to add new contacts.");
    auto addButton = new QPushButton("add");
    connect(addButton, &QAbstractButton::clicked, this, &NewAddressTab::addEntry);

    auto mainLayout = new QVBoxLayout();
    mainLayout->addWidget(descLabel);
    mainLayout->addWidget(addButton, 0, Qt::AlignCenter);
    setLayout(mainLayout);
}

void NewAddressTab::addEntry(){
    AddDialog dlg;
    if (dlg.exec()){
        emit sendDetails(dlg.name(),dlg.address());
    }
}
